/**
 * 将token 存储到 redis中
 */
import Cookie from 'js-cookie';

const key: string = 'X-Gollum-Auth';

//设置token
export const setToken = (value: string) => {
  Cookie.set(key, value);
};

//获取token
export const  getToken= (): string | undefined  => {
  return Cookie.get(key);
};

//删除token
export const delToken = (): void => {
  Cookie.remove(key);
};

/**
 * 检查认证信息
 * @param authType
 * @returns {boolean}
 */
export const checkAuthorization = (): boolean => {
  if (getToken()) {
    return true;
  }
  return false;
};
